import type { MockMethod } from 'vite-plugin-mock';
import Mock from 'mockjs';

const getMcpList: MockMethod = {
  url: '/api/mcpservice',
  timeout: 200,
  method: 'get',
  response: () => {
    const result = Mock.mock({
      'services|21': [
        {
          mcpserviceId: '@guid',
          author: '@cname(2,5)',
          description: '@cparagraph()',
          icon: '',
          name: '@cword(3,5)',
        },
      ],
      totalCount: 21,
      currentPage: 1,
    });
    return {
      code: 200,
      result: result,
      message: 'operation succeed',
    };
  },
};

const getMcpDetail: MockMethod = {
  url: '/api/mcpservice/:mcpserviceId',
  timeout: 200,
  method: 'get',
  response: ({ query }) => {
    const result = Mock.mock({
      serviceId: query.mcpserviceId,
      icon: '',
      name: '@ctitle(5,10)',
      description: '@cparagraph(40,1000)',
      data: {
        transmitProto: '@pick(Stdio, Streamable, SSE)',
        config:
          '{\n  "amap-maps":{\n"command":"cmd/c",\n"args":[\n"npx",\n"-y",\n"@amap/amap-maps-mcp-server"\n]}}',
      },
      'tools|2': [
        {
          name: '@ctitle(5,10)',
          description: '@cparagraph(10,20)',
          'input_args|1-10': [
            {
              name: '@word(3,5)',
              description: '@cparagraph(10,20)',
              type: '@pick(string, number, boolean)',
            },
          ],
          'output_args|1-10': [
            {
              name: '@word(3,5)',
              description: '@cparagraph(10,20)',
              type: '@pick(string, number, boolean)',
            },
          ],
        },
      ],
    });
    return {
      code: 200,
      result: result,
      message: 'operation succeed',
    };
  },
};

export const mcpService: Array<MockMethod> = [getMcpList, getMcpDetail];
